{% extends "base.volt" %}

{% block pageHeader %}
    {{ stylesheet_link("/libs/bootstrap-daterangepicker/daterangepicker.css", false) }}
    <style>
        .tabs { display: none;}
        .checkbox-inline+.checkbox-inline{ margin-right: 10px;margin-left: 0;}
    </style>
    
{% endblock %}

{% block pageFooter%}
<script type="text/javascript">
        var domainPic = '{{ this.di.get('appConfig').application.domainPic }}';
        var urlEditorPT = '{{ url.get('tools/editorPT') }}';
        var urlList = '{{ url.get('om/advertisementList') }}';
    </script>
    {{ javascript_include("/assets/manage/js/editor_pt_view.js", false) }}
    {{ javascript_include("/libs/bootstrap-daterangepicker/moment.min.js", false) }}
    {{ javascript_include("/libs/bootstrap-daterangepicker/daterangepicker.js", false) }}
		
    <script type="text/javascript" charset="utf-8" src="/libs/UEditor/utf8-php/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/libs/UEditor/utf8-php/ueditor.all.min.js"> </script>
    <script type="text/javascript" charset="utf-8" src="/libs/UEditor/utf8-php/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript" charset="utf-8" src="/libs/UEditor/utf8-php/addCustomizeButton.js"></script>
    {{ javascript_include("/assets/manage/js/om/advertisementAdd.js", false) }}
    
{% endblock %}

{% block content %}
    {{ partial("module/left_om") }}
    <div class="col-xs-10">
        <ol class="breadcrumb">
            <li>广告位管理</li>
            <li class="active">修改广告位</li>
        </ol>
           
       <form id="form_add"  class="form-horizontal" role="form" method="post" urlList="{{url.get('om/advertisementList')}}" action="" target="ifr_send_file" enctype="multipart/form-data">
            <input type="hidden" name="callback" value="parent.setFormResult">
            <input type="hidden" name="advertisement_id" value="{{info.advertisement_id}}">
            <div class="form-group">
                <label for="city_id" class="col-xs-2 control-label">城市</label>
                <div class="col-xs-2">
                {% if info.city_id == 0 %}
            		全国
            	{%else%}
            		{% for oc in openCity %}
            			{% if info.city_id == oc.city_id %}
            				{{oc.city_name}}
            			{%endif%}
            		{% endfor %}	
            	{%endif%}
                </div>
            </div>
            <!-- <div class="form-group">
            	<label for="bp_is_sell" class="col-xs-2 control-label">城市</label>
            	<div class="col-xs-9">
                	<select class="form-control" name="filterCity" id="filterCity">
                	<option value="0" {{ info.city_id == 0 ? 'selected="selected"' : '' }}>全国</option>
                                {% for oc in openCity %}
                                    <option value="{{ oc.city_id }}" {{ info.city_id == oc.city_id ? 'selected="selected"' : '' }} >{{ oc.city_name|e }}</option>
                                {% endfor %}
                    </select>
            	</div>
            </div> -->	
            <!-- <div class="form-group">
            	<label for="bp_is_sell" class="col-xs-2 control-label">城市</label>
            	<div class="col-xs-9">
                	<div class="checkbox">
                        <label class="checkbox-inline">
                		    <input type="checkbox" name="city[]" id="cityAll" value="0"> 全国
                        </label>
                		{% for oc in openCity %}
                    	<label class="checkbox-inline">
                        	<input type="checkbox" name="city[]" id="city" value="{{ oc.city_id }}"> {{ oc.city_name|e }}
                    	</label>
                		{% endfor %}
                	</div>
            	</div>
        	</div> -->
        	<div class="form-group">
            	<label class="col-xs-2 control-label" for="">位置</label>
        		<div class="col-xs-9">
                	<select class="form-control" name="position" id="position">
                		<option value="0">请选择</option>
                    	<option value="1" {{ info.position == 1 ? 'selected="selected"' : '' }}>通栏一</option>
                    	<option value="2" {{ info.position == 2 ? 'selected="selected"' : '' }}>通栏二</option>
                    	<option value="3" {{ info.position == 3 ? 'selected="selected"' : '' }}>通栏三</option>
                	</select>
                </div>            
           </div>
            <div class="form-group">
                <label for="activity_title" class="col-xs-2 control-label">标题</label>
                <div class="col-xs-9">
                    <input type="text" value="{{info.advertisement_title}}" class="form-control" id="advertisement_title" name="advertisement_title" data-rule="required;">
                </div>
            </div>
            
            <div class="form-group">
                <label for="advertisement_cover" class="col-xs-2 control-label">封面</label>
                <div class="col-xs-6">      
                <img style="width:400px;height:200px;" src="{{ info.advertisement_cover }}"/>           
                    <input type="file" class="form-control" id="advertisement_cover" name="advertisement_cover">
                    <p id="imgInfo" class="help-block">*支持JPG，PNG，JPEG格式的图片，大小不超过1M，尺寸为：750X200px</p>
                </div>
            </div>
            <div class="choose-tab">
                <label for="advertisement_intro" class="col-xs-2 control-label">活动介绍</label>
                <div id="choose">
                	<input id="intro1" name="type" type="radio" value="1" {{ 1 == info.type ? 'checked="checked"' : '' }}>图文介绍
                    <input id="intro2" name="type" type="radio" value="2" {{ 2 == info.type ? 'checked="checked"' : '' }}>外链地址
                </div>
                
                	<div {{ info.type == 1 ? 'class="col-xs-9 tabs show"' : 'class="col-xs-9 tabs"' }}>	    
    					<textarea id="editor" style="width:600px;height:300px;" name="advertisement_intro" >
    						{{info.advertisement_intro}}
    					</textarea> 
    				</div>	 				
                	<div {{ info.type == 2 ? 'class="col-xs-9 tabs show"' : 'class="col-xs-9 tabs"' }}>
                    	<input type="text" class="form-control" value="{{info.out_link}}" id="out_link" name="out_link" >
            	</div>
            </div>
            <div class="form-group">
                <div class="col-xs-12 text-center">
                    <button id="btn_save" type="submit" class="btn btn-primary"><i class="fa fa-floppy-o fa-lg"></i> 保 存</button>
                </div>
            </div>
        </form>
        
    </div>
    
    
    
{% endblock %}